//
//  PlayerSettingController.h
//  MapEdit
//
//  Created by Steven Canfield on 7/10/07.
//  Copyright 2007 __MyCompanyName__. All rights reserved.
//

#import <Cocoa/Cocoa.h>
#import "Player.h"
#import "NSMutableDataAdditions.h"
#import "NSColorAdditions.h"
#import "StringManager.h"

@interface PlayerSettingController : NSObject {
	IBOutlet NSTableView	* tableView1;
	IBOutlet NSTableView	* tableView2;
	IBOutlet NSTableView	* tableView3;
	IBOutlet NSTableView	* tableView4;
	NSArray					* tableViewArray;
	
	IBOutlet NSButton		* randomStart1;
	IBOutlet NSButton		* randomStart2;
	IBOutlet NSButton		* randomStart3;
	IBOutlet NSButton		* randomStart4;
	NSArray					* randomStartArray;

	IBOutlet NSButton		* allied1;
	IBOutlet NSButton		* allied2;
	IBOutlet NSButton		* allied3;
	IBOutlet NSButton		* allied4;
	NSArray					* alliedArray;

	IBOutlet NSButton		* alliedVictory1;
	IBOutlet NSButton		* alliedVictory2;
	IBOutlet NSButton		* alliedVictory3;
	IBOutlet NSButton		* alliedVictory4;
	NSArray					* alliedVictoryArray;
	
	IBOutlet NSButton		* sharedVision1;
	IBOutlet NSButton		* sharedVision2;
	IBOutlet NSButton		* sharedVision3;
	IBOutlet NSButton		* sharedVision4;
	NSArray					* sharedVisionArray;

	IBOutlet NSTextField	* forceName1;
	IBOutlet NSTextField	* forceName2;
	IBOutlet NSTextField	* forceName3;
	IBOutlet NSTextField	* forceName4;
	NSArray					* forceNameArray;
	
	NSMutableArray			* forceSetArray;
	
	StringManager			* stringManager;
	
	chk_iown_t playerOwner;
	chk_ownr_t owner;
	chk_side_t side;
	chk_forc_t force;
	chk_colr_t color;
}
- (void)reloadAllData;
- (void)initializeForceSets;
- (void)loadIOWN:(NSData *)iownData;
- (void)loadOWNR:(NSData *)ownrData;
- (void)loadSIDE:(NSData *)sideData;
- (void)loadFORC:(NSData *)forcData;
- (void)loadCOLR:(NSData *)colrData;
- (NSData *)serializedIOWN;
- (NSData *)serializedOWNR;
- (NSData *)serializedSIDE;
- (NSData *)serializedFORC;
- (NSData *)serializedCOLR;

- (void)setStringManager:(StringManager *)manager;

- (BOOL)forceHasRandomStartLocation:(int)forceNumber;
- (BOOL)forceIsAllied:(int)forceNumber;
- (BOOL)forceHasAlliedVictory:(int)forceNumber;
- (BOOL)forceHasSharedVision:(int)forceNumber;

- (IBAction)propertyChanged:(id)sender;
- (int)numberOfRowsInTableView:(NSTableView *)tableView;
- (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)rowIndex;
- (void)tableView:(NSTableView *)tableView setObjectValue:(id)value forTableColumn:(NSTableColumn *)tableColumn row:(int)rowIndex;
- (BOOL)tableView:(NSTableView *)tv writeRowsWithIndexes:(NSIndexSet *)rowIndexes toPasteboard:(NSPasteboard*)pboard;
- (NSDragOperation)tableView:(NSTableView*)tv validateDrop:(id <NSDraggingInfo>)info proposedRow:(int)row proposedDropOperation:(NSTableViewDropOperation)op;
- (BOOL)tableView:(NSTableView *)aTableView acceptDrop:(id <NSDraggingInfo>)info row:(int)row dropOperation:(NSTableViewDropOperation)operation;
- (NSImage *)imageCellForPlayerColor:(int)playerColor;
- (NSColor *)colorForPlayerIndex:(int)index;
- (int)playerNumberForTableView:(NSTableView *)aTableView rowIndex:(int)rowIndex;
@end
